import numpy as np


def _plot_hist(img, acc,  *args, **kwargs):
    if len(args)==1:
        range_x = args[0]
    if len(args)==2:
        range_y = args[1]
    if len(args)>2:
        assert 0, 'error input num'
    line = img.reshape(-1)
    line = sorted(line)
    line = np.floor(line * 10) / 10
    idx = np.where(np.array(line)>range_y[0] or np.array(line)<range_y[1])
    line = line[idx]

    line[np.array(line)<range_x[0]] = 0
    np.array(line) > range_x[1]
    line = line[line!=0]

    return img
